import GameEvent from "../GameEvent";

export default class PlayerData {
    constructor() { }
    public static gold: number = 0;
    public static attackSpeedLv: number = 1;
    public static diamond: number = 0;
    public static mapLevel: number = 1;
    public static mapBgId: number = 10001;
    public static heroId: number = 10001;
    public static attackLv: number = 1;
    public static hpLv: number = 1;
    public static heros: number[] = [10001];


    _attackLv: number = PlayerData.attackSpeedLv;
    attack: number;
    attackSpeed: number;
    attackSpeedValue: number;
    _gold: number = PlayerData.gold;
    _diamond: number = PlayerData.diamond;
    mapLevel: number = PlayerData.mapLevel;
    mapBgId: number = PlayerData.mapBgId;
    heroId: number = PlayerData.heroId;
    heroResPath: string;
    _attackSpeedLv: number = PlayerData.attackSpeedLv;
    _hpLv: number = PlayerData.hpLv;
    preSignTime: number = 0;
    firstSignTime: number = 0;
    hp: number;
    heros: number[] = PlayerData.heros;

    public get diamond() {
        return this._diamond;
    }

    public set diamond(value) {
        // console.log("gold", value)
        if (this._diamond !== value) {
            this._diamond = value;
            Laya.stage.event(GameEvent.REFRESH_DIAMOND);
        }
    }

    public get gold() {
        return this._gold;
    }

    public set gold(value) {
        // console.log("gold", value)
        if (this._gold !== value) {
            this._gold = value;
            Laya.stage.event(GameEvent.REFRESH_GOLD);
        }
    }

    public get attackLv() {
        return this._attackLv;
    }
    public set attackLv(value) {
        // console.log("attackLv", value)
        if (this._attackLv !== value) {
            this._attackLv = value;
            Laya.stage.event(GameEvent.REFRESH_ATTACK_LV);
        }
    }
    public get attackSpeedLv() {
        return this._attackSpeedLv;
    }
    public set attackSpeedLv(value) {
        this._attackSpeedLv = value;
    }
    public get hpLv() {
        return this._hpLv;
    }
    public set hpLv(value) {
        if (this._hpLv !== value) {
            this._hpLv = value;
            Laya.stage.event(GameEvent.REFRESH_HP_LV);
        }
    }
}